Add early cluster validation to prevent wasted build time in func deploy#3117
Conversation
|
Hi @RayyanSeliya. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3117 +/- ##
==========================================
+ Coverage 59.91% 63.14% +3.22%
==========================================
Files 150 150
Lines 13353 13501 +148
==========================================
+ Hits 8001 8525 +524
+ Misses 4416 3971 -445
- Partials 936 1005 +69
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/ok-to-test |
|
Im not much of a fan of this implementation... its still "test aware" as Matej said - with those literal strings and constants. Also there has to be some better way to implement this 🤔 |
@gauron99 Good point about the client architecture! I checked I'm thinking we could add: func (c *Client) ClusterAvailable(ctx context.Context) errorThen just call it before building. Tests would naturally skip it since they use The challenge is timing - we currently validate before creating the client (line 423 vs line 462 in
Which direction makes more sense for the existing code? Don't want to refactor the way which is not feasible ..! |
|
This one is a little tricky... I think it might be worth looking into placing this validation in the deployer implementation itself, returing a typed error on failure, and then capturing this error in the CLI and adding "CLI specific" help text as necessary. Remember that it's ok if the system builds and then fails on deployment, because it should not repeat the build on a subsequent deploy (it detects the build is "fresh"). |
02c38ab to
0c72cf2
Compare
thx for the feedback @lkingland that makes sense and sounds good to have the validation into the deployer itself with typed errors and CLI just catches those and provide a user-friendly errors ! can have a look now and ping me if any more changes needed ! |
|
@RayyanSeliya: GitHub didn't allow me to request PR reviews from the following users: take, when, some, moments, pls, a, look, have. Note that only knative members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cc @lkingland |
lkingland
left a comment
There was a problem hiding this comment.
/lgtm
Thanks for taking the time to work through a few iterations on this one
Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
…er instead of too much pre-validation at the cli Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
0c72cf2 to
4cb046b
Compare
|
hey @lkingland dont know why the test are failing !! |
|
/override ? |
|
@gauron99: /override requires failed status contexts, check run or a prowjob name to operate on.
Only the following failed contexts/checkruns were expected:
If you are trying to override a checkrun that has a space in it, you must put a double quote on the context. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/override "On Cluster RT Test (ubuntu-latest, pack)" "E2E Test (ubuntu-latest, springboot)" |
|
@gauron99: Overrode contexts on behalf of gauron99: E2E Test (ubuntu-latest, springboot), On Cluster RT Test (ubuntu-latest, pack) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
These fails are unrelated. Its an issue with our custom pack builder currently |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauron99, lkingland, RayyanSeliya The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Yeah ! 👍Thx .. |
Changes
func deployWhat Changed
func deploynow validates Kubernetes cluster connectivity before starting the container build process, preventing wasted time when the cluster is inaccessible.Before:
--build=falsewas usedAfter:
Implementation
Added 2-layer error handling:
pkg/functions/errors.go): Technical errors (ErrInvalidKubeconfig,ErrClusterNotAccessible)cmd/deploy.go): User-friendly CLI messages with examplesDetects three distinct error scenarios:
Testing
Tested all combinations:
TestDeploy_ConfigPrecedence, etc.)/kind bug
Fixes #3116
Release Note